<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<link rel="stylesheet" type="text/css" href="/css/notice.css"/>
<script type="text/javascript" src="/js/notice.js"></script>

<s:url id="listURLPrev" value="/notice/noticeList.desk">
	<s:param name="pageNumber">
		<s:property value="pageInfoDataMap.pageNumber - 1"/>
	</s:param>
</s:url>

<s:url id="listURLNext" value="/notice/noticeList.desk">
	<s:param name="pageNumber">
		<s:property value="pageInfoDataMap.pageNumber + 1"/>
	</s:param>
</s:url>

<s:set name="authCode" value="#session.authCode"/>
<s:set name="totalCount" value="%{pageInfoDataMap.totalCount}"/>
	
	  <!-- 오른쪽 내용 시작 -->
      <dl class="Right_Contents_area">
        <dd class="Center_Top_title"> <span class="top_title"><img src="/images/notice/SubContents_Tit_01.gif" width="370" height="42" alt="공지사항" /></span> <span class="top_navi">HOME > 공지사항</span></dd>
        <dd class="Right_Contents_Notice">총 <span class="TEXT_Red_Bold"><s:property value="%{#totalCount}"/></span>건의 공지사항이 등록됨</dd>
        <dd class="Center_Top_contents">
          <div id="LIst_Zone">
            <dl>
              <dd>
                <table cellspacing="0" border="1" summary="글목록" class="Listboard">
                  <caption>글목록</caption>
                  <colgroup><col width="55"><col width="1"><col width="350"><col width="1"><col width="84"><col width="1"><col width="81"><col width="1"><col width="81"><col width="1"><col width="63"></colgroup>
                  <thead>
                    <tr>
                      <th scope="col">번호</th>
                      <th scope="col"><img src="/images/notice/board_line.gif" width="1" height="30" alt="" /></th>
                      <th scope="col">제목</th>
                      <th scope="col"><img src="/images/notice/board_line.gif" width="1" height="30" alt="" /></th>
                      <th scope="col">글쓴이</th>
                      <th scope="col"><img src="/images/notice/board_line.gif" width="1" height="30" alt="" /></th>
                      <th scope="col">첨부파일</th>
                      <th scope="col"><img src="/images/notice/board_line.gif" width="1" height="30" alt="" /></th>                      
                      <th scope="col">작성일자</th>
                      <th scope="col"><img src="/images/notice/board_line.gif" width="1" height="30" alt="" /></th>
                      <th scope="col">조회수</th>
                    </tr>
                  </thead>
                  <tbody>
                  	<s:if test="noticeList.size == 0">
			     		<tr>
							<td colspan="13" style="text-align: center">등록된 공지사항이 없습니다.</td>
						</tr>
					</s:if>
					<s:else>
						<s:iterator value="noticeList" status="stat">
	                    <tr>
	                      <td><s:property value="(#totalCount + 1 - ((pageInfoDataMap.pageNumber - 1) * pageInfoDataMap.countPerPage)) - (#stat.count)"/></td>
	                      <td><img src="/images/notice/board_line2.gif" width="1" height="24" alt="" /></td>
	                      <td class="tdTit"><a href="/notice/noticeDetail.desk?noticeSeq=<s:property value="noticeSeq"/>"><s:property value="title"/></a></td>
	                      <td><img src="/images/notice/board_line2.gif" width="1" height="24" alt="" /></td>
	                      <td><s:property value="userName"/></td>
	                      <td><img src="/images/notice/board_line2.gif" width="1" height="24" alt="" /></td>
	                      <td>
	                      <!-- 
	                       <s:if test="%{uploadFileName != null}">
	                      		<s:url id="download" namespace="/common" action="fileDownload.desk" includeParams="none">
		                       		<s:param name="fileName"><s:property value="uploadFileName"/></s:param>
		                       		<s:param name="filePath"><s:property value="pathName"/></s:param>
		                       	</s:url>
                       			<a href="/common/fileDownload.desk?filePath=<s:property value="pathName"/>&fileName=<s:property value="uploadFileName"/>"><img src="/images/notice/icon_file.gif" alt="첨부파일" width="11" height="11" border="0" /></a>
	                      	</s:if>
	                      
	                      	<s:if test="%{uploadFileName != null}">
	                      		<s:url id="download" namespace="/common" action="fileDownload.desk" includeParams="none">
		                       		<s:param name="fileName"><s:property value="uploadFileName"/></s:param>
		                       		<s:param name="filePath"><s:property value="pathName"/></s:param>
		                       	</s:url>
                       			<s:a href="%{download}"><img src="/images/notice/icon_file.gif" alt="첨부파일" width="11" height="11" border="0" /></s:a>
	                      	</s:if>
	                      	-->
	                      	
	                      	<s:if test="%{uploadFileName != null}">
	                      		<form name="form_file_download<s:property value="#stat.count"/>" method="POST" action="/common/fileDownload.desk">
		                      		<input type="hidden" name="fileName" value="<s:property value="uploadFileName"/>"/>
		                      		<input type="hidden" name="filePath" value="<s:property value="pathName"/>"/>
	                      		</form>
	                      		<img src="/images/notice/icon_file.gif" class="btn_img_download" alt="첨부파일" width="11" height="11" border="0" style="cursor:pointer"/>
	                      	</s:if>
	                      </td>                      
	                      <td><img src="/images/notice/board_line2.gif" width="1" height="24" alt="" /></td>
	                      <td><s:property value="writeTime"/></td>
	                      <td><img src="/images/notice/board_line2.gif" width="1" height="24" alt="" /></td>
	                      <td><s:property value="readCount"/></td>
	                    </tr>
                        </s:iterator>
                    </s:else>                                                           
                  </tbody>
                  <!-- 리스트 부분 -->
                </table>
              </dd>
               
            </dl> 
            <dl class="List_Page_area"><!-- 리스트 페이징 부분 -->
              <dd class="page_area">
                <div class="paginate">
                    <s:if test="pageInfoDataMap.startPage > pageInfoDataMap.pagePerBlock">
						<s:a href="%{listURLPrev}" cssClass="pre">이전페이지</s:a>
					</s:if> 
			      	<c:forEach var="pageNum" begin="${pageInfoDataMap.startPage}" end="${pageInfoDataMap.endPage}">
						<c:choose>
							<c:when test="${pageNum != 0 && pageNum == pageInfoDataMap.pageNumber}">
								${pageNum}
							</c:when>
							<c:when test="${pageNum == 0 }">
							
							</c:when>
							<c:otherwise>
								<a href="<c:url value="/notice/noticeList.desk?pageNumber=${pageNum}"/>"> [${pageNum}] </a>
							</c:otherwise>
						</c:choose>
					</c:forEach>
			      	<s:if test="pageInfoDataMap.endPage < pageInfoDataMap.totalPageCount">
						<s:a href="%{listURLNext}" cssClass="next">다음페이지 </s:a>
					</s:if>
                </div>               
              </dd>            
            </dl><!-- 리스트 페이징 부분 -->
            <dl class="List_Btn_area"><!-- 버튼 부분 -->
             <dd class="Left_Zone"><a href="/notice/noticeList.desk"><img src="/images/notice/btn_list.gif" alt="목록" width="52" height="26" border="0" /></a></dd>
             <s:if test="#authCode == 'ADMIN'">
             <dd class="Right_Zone"><a href="/notice/noticeForm.desk"><img src="/images/notice/btn_write.gif" width="70" height="26" alt="글쓰기" border="0" /></a></dd>
             </s:if>
            </dl><!-- 버튼 부분 -->          
          </div>
        </dd>
      </dl>
      <!-- 오른쪽 내용 끝 --> 
    </div>
  </div>
  <!-- center 나누어 지는 부분 끝 --> 
</div>